package
{
	import org.cove.ape.*;
	import flash.display.*;
	import flash.events.*;
	//un fel de minimap
	//format din 2 dreptunghiuri suprapuse
	//unul reprezinta ecranul(camera) care se plimba stanga/dreapta pe
	//celalat care reprezinta terenul
	
	public class MiniView
	{
		private var model:IModel;
		private var theLevel:Shape = new Shape();
		private var theCamera:Shape = new Shape();
		
		public function MiniView(aModel:IModel,target:Stage)
		{
			
            theLevel.graphics.beginFill(0x00FF33);
            theLevel.graphics.lineStyle(0, 0x0066AA);
            theLevel.graphics.drawRoundRect(450, 0, 125, 15, 8);
            theLevel.graphics.endFill();
            target.addChild(theLevel);
            
            theCamera.graphics.beginFill(0x00CC00);
            theCamera.graphics.lineStyle(0, 0xff0066);
            theCamera.graphics.drawRoundRect(450, 0, 35, 15, 8);
            theCamera.graphics.endFill();
            target.addChild(theCamera);
            
            this.model = aModel;
            
            model.addEventListener(Event.CHANGE, this.update);	
            
		}
		
		private function update(event:Event):void
		{
			theCamera.x=50-APEngine.container.x/10;
		}
	}
}